package pri.zxx.learndemo.designmodels.strategymodel.wx;

import pri.zxx.learndemo.designmodels.strategymodel.AbstractMsgContent;

import java.util.HashMap;
import java.util.Map;

/**
 * @author Twilight
 * @desc
 * @createTime 2020-06-09-20:51
 */
public class WxContent extends AbstractMsgContent {
    private AppPath appPath;
    private Map<String, ValueEntry> vars;


    public WxContent(Map<String, Object> data, String temId) {
        super(temId);
        this.appPath = new AppPath(data.remove("appId") + "", data.remove("path") + "");
        Map<String, ValueEntry> map = new HashMap<>();
        data.forEach((ke, va) -> map.put(ke, new ValueEntry(va)));
        this.vars = map;
    }


    public Map<String, ValueEntry> getVars() {
        return vars;
    }

    public void setVars(Map<String, ValueEntry> vars) {
        this.vars = vars;
    }

    public AppPath getAppPath() {
        return appPath;
    }

    public void setAppPath(AppPath appPath) {
        this.appPath = appPath;
    }

    private class AppPath {
        private String path;
        private String appId;

        public AppPath(String path, String appId) {
            this.path = path;
            this.appId = appId;
        }

        public String getPath() {
            return path;
        }

        public void setPath(String path) {
            this.path = path;
        }

        public String getAppId() {
            return appId;
        }

        public void setAppId(String appId) {
            this.appId = appId;
        }
    }

    private class ValueEntry {
        private Object value;

        public ValueEntry(Object value) {
            this.value = value;
        }

        public Object getValue() {
            return value;
        }

        public void setValue(Object value) {
            this.value = value;
        }
    }
}

